/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package app;

import app.ui.MainPanel;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
 *
 * @author bharat
 */
public class SiftDemo {

    public static void main(String[] args) {
        JFrame frame = new JFrame("CSCI-576: SIFT Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE ) ;
        JPanel panel = new MainPanel();

        frame.setContentPane(panel);
        frame.pack();
        frame.setVisible(true);

        /*

        JLabel label = new JLabel();

        /*
        label.setIcon(new ImageIcon(img));
        panel.add(label);
	panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
	//panel.setPreferredSize(new Dimension(1024, 768));
       
        int octvs = ((int) (Math.log(Math.min(img.getWidth(), img.getHeight())) / Math.log(2))) - 2;

        GaussianScaleSpacePyramidBuilder gpb = new GaussianScaleSpacePyramidBuilder();
        BufferedImage[][] imgPyramids = gpb.buildGaussianPyramid(img, octvs, SiftSettings.SIFT_INTERVALS, SiftSettings.SIFT_SIGMA);
        BufferedImage[][] DOGPyramids = new BufferedImage[octvs][];

        for (int o = 0; o < octvs; o++) {
            DOGPyramids[o] = gpb.buildDogPyramid(imgPyramids[o], octvs, SiftSettings.SIFT_INTERVALS);
        }

        ScaleSpaceExtremaDetector sced = new ScaleSpaceExtremaDetector();
        ArrayList<SiftFeature> features = sced.detectExtremas(DOGPyramids, octvs, SiftSettings.SIFT_INTERVALS, SiftSettings.SIFT_CONTRAST_THRESOLD, SiftSettings.SIFT_CURVATURE_THRESOLD) ;


	JScrollPane scrollpane = new JScrollPane();
        
        for (int i = 0; i < imgPyramids.length; i++) {
            for (int j = 0; j < imgPyramids[0].length; j++) {
                label = new JLabel();
                label.setIcon(new ImageIcon(imgPyramids[i][j]));
                panel.add(label);
		panel.add(new JSeparator()) ;
            }
        }

	for (int i = 0; i < DOGPyramids.length; i++) {
            for (int j = 0; j < DOGPyramids[i].length; j++) {
                label = new JLabel();
                label.setIcon(new ImageIcon(DOGPyramids[i][j]));
                panel.add(new JSeparator()) ;
		label.setBorder(new TitledBorder("DoG")) ;
		panel.add(label);
            }
        }


        
        //ImageUtils.makeGaussianKernel(0.84089642f) ;
	scrollpane.setViewportView(panel) ;
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setContentPane(scrollpane);
        frame.pack();
        frame.setVisible(true);
        */

    }
}
